﻿//using Ext.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using eutolisoModel;


public partial class AccountAdmin_Veiculo_Tipo_Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            loadVeiculoTipo();
        }

    }

    private void loadVeiculoTipo()
    {
        using (eutolisoEntities dbContext = new eutolisoEntities())
        {
            
        }

    }

    //[DirectMethod]
    public void Gravar()
    {


        using (eutolisoEntities dbContext = new eutolisoEntities())
        {
            veiculoTipo veiTipo = new veiculoTipo();

           // veiTipo.vet_nome = txtNome.Text;

            veiTipo.vet_nome = txtNome.Text;

            dbContext.veiculoTipo.AddObject(veiTipo);

            dbContext.SaveChanges();
            
        }
               
    }

    //public int SelectByID(int id)
    //{
    //    using (eutolisoEntities db = new eutolisoEntities()) 
    //    {
    //        veiculoTipo vt = new veiculoTipo();

    //        var tipo = 

            
    //    }

    //    return id;
    //}


    // This is the Delete methd to delete the selected VeiculoTipo item
    // USAGE: <asp:FormView DeleteMethod="DeleteItem">
    //public void DeleteItem(int Id)
    //{
    //    using (var context = new eutolisoEntities())
    //    {
    //        var item = context.veiculoTipo.f

    //        if (item != null)
    //        {
    //            context.veiculoTipo.Remove(item);
    //            context.SaveChanges();
    //        }
    //    }
    //    Response.Redirect("../Default");
    //}

    // This is the Select methd to selects a single VeiculoTipo item with the id
    // USAGE: <asp:FormView SelectMethod="GetItem">
    //public VeiculoTipo GetItem([FriendlyUrlSegmentsAttribute(0)]int? Id)
    //{
    //    if (Id == null)
    //    {
    //        return null;
    //    }

    //    using (var context = new EUTOLISOContext())
    //    {
    //        return context.VeiculoTipo.Find(Id);
    //    }
    //}

    protected void Button1_Click(object sender, EventArgs e)
    {
        Gravar();
        grvVeiculoTipo.DataBind();
    }
}